#include "../headers/RoundRobin.h"
#include <iostream>

using namespace std;
extern int N;

RoundRobin::RoundRobin(vector<OSThread*>* threads, int quanta) :
	OSScheduler(*threads), quanta(quanta), lastThread(0)
{
}

RoundRobin::~RoundRobin()
{
}

void RoundRobin::runSomeThread(){

	int next= (lastThread == (N-1)) ? 1 : (lastThread + 1);

	giveQuanta(next, quanta);

	lastThread=next;
	return;
}